<template>
  <div class="homeOne">
    <div class="w">
      <div class="head">
        <!-- 具名插槽 -->
        <slot name="title"></slot>
      </div>
      <!-- 列表展示 -->
      <ul class="reveal">
        <template v-if="flag == 'new'">
          <li v-for="item in newData" :key="item.id">
            <img :src="item.picture" alt="" />
            <p>{{ item.name }}</p>
            <span>￥{{ item.price }}</span>
          </li>
        </template>
        <template v-if="flag == 'hot'">
          <li
            v-for="item in newData"
            :key="item.id"
            :class="{ bgc: flag == 'hot' }"
          >
            <img :src="item.picture" alt="" />
            <p>{{ item.title }}</p>
            <span :class="{ fontStyle: flag == 'hot' }">{{ item.alt }}</span>
          </li>
        </template>
      </ul>
    </div>
  </div>
</template>

<script>
export default {
  props: ["newData", "flag"],
};
</script>

<style lang="scss" scoped>
// 引入公共样式
@import "@/assets/css/hoverShadow.scss";
.w {
  background-color: white;
  .head {
    width: 100%;
    height: 115px;
    display: flex;
    align-items: center;
  }

  h3 {
    flex: 1;
    font-size: 32px;
    font-weight: 400;
    margin-left: 6px;
    height: 35px;
    line-height: 35px;
    span {
      font-size: 16px;
      color: #999;
      margin-left: 20px;
      vertical-align: middle;
    }
  }
  .all {
    margin-right: 4px;
    color: #999;
  }
  .all:hover {
    color: #27ba9b;
    cursor: pointer;
  }

  .reveal {
    width: 100%;
    height: 406px;
    // background-color: #27ba9b;
    display: flex;
    justify-content: space-between;
    li:hover {
      @include hoverShadow;
    }
    li {
      width: 306px;
      height: 100%;
      background-color: #f0f9f4;
      cursor: pointer;
      img {
        width: 100%;
        height: 306px;
      }
      p {
        width: 100%;
        font-size: 22px;
        text-align: center;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        padding: 12px 30px 0px;
      }
      span {
        display: inline-block;
        width: 100%;
        font-size: 22px;
        padding: 12px 30px 0 30px;
        text-align: center;
        color: red;
      }
    }
  }
}
.fontStyle {
  font-size: 18px !important;
  color: #999999 !important;
}
.bgc {
  background-color: white !important;
}
</style>
